package com.pai4j.domain.community;
import com.pai4j.domain.vo.response.UserBaseResponseInfoVO;
import com.pai4j.pgc.entity.community.CCVideoEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 *
 *
 * @author: CYM-pai
 * @date: 2025/10/28 20:44
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CTCHomeRecommendVideoVO {

    private Long id;

    private String title;

    private String video;

    private String cover;

    private List<String> signs;

    private Long viewCount;

    private Long time;

    private String author;

    private Long createTime;

    private Boolean free;

    private UserBaseResponseInfoVO authorUser;

    /**
     * 是否有生成内容
     */
    private Boolean hasSummary;

    public CTCHomeRecommendVideoVO(CCVideoEntity video) {
        this.id = video.getId();
        this.title = video.getTitle();
        this.time = video.getCreateDate().getTime();
        this.video = video.getVideo();
        this.cover = video.getCover();
        this.author = video.getAuthor();
        this.free = video.getFree();
        this.signs = new ArrayList<>();
        this.createTime = video.getCreateDate().getTime();
        if (StringUtils.isNotBlank(video.getSigns())) {
            this.signs = Arrays.stream(video.getSigns().split(",")).collect(Collectors.toList());
        }
    }
}
